<#include "/common/mobile.html" /> <@layout>
<head>

</head>
<script>
	function edit() {
		var id = $("#id").attr("value")
		var url = "${ctx}/wxContent/edit?id=" + id;
		window.location.href = url;
	}
	function gk() {
			  var id=$("#id").attr("value")
		      var url = '${ctx}/wxContent/gk?id='+id;
		      $('#myform').form('submit', {
		          url : url,
		          onSubmit : function() {
		          },
		          success : function(data) {
		              // 回填页面
		        	  var url ="${ctx}/wxContent?id="+id+"&from=user";
		        	  window.location.href=url;
		          }
		      });
	}
	function dels(obj) {
		var url = '${ctx}/weixin/savetype/';
		$('#myform').form('submit', {
			url : url,
			onSubmit : function() {
			},
			success : function(data) {
				// 回填页面
				alert(data);
				WeixinJSBridge.invoke('closeWindow',{},function(res){
				});
			}
		});
	}
</script>
<body>
	<div class="page-content">
		<div class="row-fluid">
			<div class="span12">
				<div style="text-align: center">
				<#if (argu)??> 
					<#if (argu)=="edit">
						<p  class="alert alert-info"> 	
					本文处于公开状态，点击私密按钮取消公开。</br>
					<#if (gkzt)??> 
					<#if (gkzt)=="1"> <a href="#"
						class="btn btn-info btn-small" onclick="gk();">
						 <i class=" icon-lock"></i> 私密
					</a>&nbsp;&nbsp; 
					</#if> 
					<#if (gkzt)=="0"> <a href="#"
						class="btn btn-info btn-small" onclick="gk();"> <i class=" icon-unlock"></i> 公开
					</a>&nbsp;&nbsp; 
					</#if> 
					</#if> <a href="#"
						class="btn btn-primary btn-small" onclick="edit();">编辑</a>
					&nbsp;&nbsp; <a href="#" class="btn btn-danger btn-small"
						onclick="dels();">删除</a> </p> 
					</#if> 
					</#if> 
					<#if (argu)??> 
					<#if (argu)=="view"> 
				<p  class="alert alert-info"> 		<a href="#"
						class="btn btn-primary btn-small" onclick="dels();">选择此模板</a></p>
					</#if> 
						</#if>
				</div>
			</div>
		</div>
		<div class="row-fluid" style="padding: 2px">
			<div class="span12">
					<div class="pull-left ">
						<h3 class="bigger lighter" id="bt"><#if (newlist)??> <#list
							newlist as m> ${(m.title)!} </#list> </#if> <#if (argu)??> <#if
							(argu)=="view">${(mbmc)!} </#if> </#if></h3>
						<#if (argu)??> <#if (argu)!="view"> <small> 浏览 <#list
							newlist as m>${(m.yds)!}</#list></small> </#if> </#if>
					</div>
			</div>
		</div>
		
		<div class="hr dotted" style="background: #2283C5"></div>
		<div class="widget-header header-color-blue"></div>

		<div class="widget-body">
			<div class="widget-main" id="widget"><#if (newlist)??> <#list
				newlist as m> 
				<input type="hidden" name="id" id="id" value="${(m.id)!}">
				${(m.content)!} </#list> </#if></div>
		</div>


		</br>
		<div>
			<a
				href="http://mp.weixin.qq.com/s?__biz=MjM5NDQyOTYxNA==&mid=246067933&idx=1&sn=70875eb3cfa15e8a135bd071f95c6377#rd">
				<img src="/img/mmexport.jpg" />
			</a>
		</div>
		<!-- /.span -->
	</div>


	<!-- /.page-content -->
	<form class="form-inline" id="myform">
		<input type="hidden" name="type" id="type" value="${(type)!}">
		<input type="hidden" name="fromuser" id="fromuser"
			value="${(fromuser)!}">
	</form>
</body>
<script>
	var imgUrl = '${(pic)!}';
	var lineLink = '${(url)!}wxContent/${(id)!}';
	var descContent = '${(descContent)!}';
	var shareTitle = '${(title)!}';
	var appid = '${(AppId)!}';

	function shareFriend() {
		WeixinJSBridge.invoke('sendAppMessage', {
			"appid" : appid,
			"img_url" : imgUrl,
			"img_width" : "640",
			"img_height" : "640",
			"link" : lineLink,
			"desc" : descContent,
			"title" : shareTitle
		}, function(res) {
			_report('send_msg', res.err_msg);
		})
	}
	function shareTimeline() {
		WeixinJSBridge.invoke('shareTimeline', {
			"img_url" : imgUrl,
			"img_width" : "640",
			"img_height" : "640",
			"link" : lineLink,
			"desc" : descContent,
			"title" : shareTitle
		}, function(res) {
			_report('timeline', res.err_msg);
		});
	}
	function shareWeibo() {
		WeixinJSBridge.invoke('shareWeibo', {
			"content" : descContent,
			"url" : lineLink,
		}, function(res) {
			_report('weibo', res.err_msg);
		});
	}
	// 当微信内置浏览器完成内部初始化后会触发WeixinJSBridgeReady事件。
	document.addEventListener('WeixinJSBridgeReady', function onBridgeReady() {

		// 发送给好友
		WeixinJSBridge.on('menu:share:appmessage', function(argv) {
			shareFriend();
		});

		// 分享到朋友圈
		WeixinJSBridge.on('menu:share:timeline', function(argv) {
			shareTimeline();
		});

		// 分享到微博
		WeixinJSBridge.on('menu:share:weibo', function(argv) {
			shareWeibo();
		});
	}, false);

	var argu = '${(argu)!}';
	if (argu == "view") {
		function onBridgeReady() {
			WeixinJSBridge.call('hideOptionMenu');
		}

		if (typeof WeixinJSBridge == "undefined") {
			if (document.addEventListener) {
				document.addEventListener('WeixinJSBridgeReady', onBridgeReady,
						false);
			} else if (document.attachEvent) {
				document.attachEvent('WeixinJSBridgeReady', onBridgeReady);
				document.attachEvent('onWeixinJSBridgeReady', onBridgeReady);
			}
		} else {
			onBridgeReady();
		}
	}
</script>

</@layout>
